import request from "@/utils/request";

// 查询出差申请列表
export function listTrips(query) {
  return request({
    url: "/system/trips/list",
    method: "get",
    params: query,
  });
}

// 查询出差申请详细
export function getTrips(id) {
  return request({
    url: "/system/trips/" + id,
    method: "get",
  });
}

// 新增出差申请
export function addTrips(data) {
  return request({
    url: "/system/trips",
    method: "post",
    data: data,
  });
}

// 修改出差申请
export function updateTrips(data) {
  return request({
    url: "/system/trips",
    method: "put",
    data: data,
  });
}

// 删除出差申请
export function delTrips(id) {
  return request({
    url: "/system/trips/" + id,
    method: "delete",
  });
}

//审批出差申请
export function approveTrips(data) {
  return request({
    url: "/system/trips/aprrove",
    method: "post",
    data: data,
  });
}

//查询审批原因
export function selectApplyResult(id) {
  return request({
    url: "/system/trips/result/" + id,
    method: "post",
  });
}

//查询当前用户的出差申请记录
export function selectCurrentUserBusinessTripsById(id) {
  return request({
    url: "/system/trips/currentUser/" + id,
    method: "post",
  });
}

//根据用户id和所输入的内容来搜索出差申请记录
export function selectDetailedBusinessTripsByIdAndInput(params) {
  return request({
    url: "/system/trips/detailed/",
    method: "get",
    params: params,
  });
}

export function selectApproverName() {
  return request({
    url: "/system/trips/selectApproverName",
    method: "get",
    params: {},
  });
}

export function selectTripsDays(id) {
  return request({
    url: "/system/trips/selectTripsDays/" + id,
    method: "post",
  });
}
